#include "StdAfx.h"
#include "hitQueue.h"

hitQueue::hitQueue()
{
	active = false;
	second = 0.0;
	x = 0;
	y = 0;
	yVel = 100.0;
	text = NULL;
}
hitQueue::~hitQueue()
{
	SDL_FreeSurface(text);
}
void hitQueue::setMessage(string mes, int xa, int ya, TTF_Font *font, SDL_Color textColor)
{
	active = true;
	message = mes;
	x = xa;
	y = ya;
	second = 0.0;
	text = TTF_RenderText_Solid(font, message.c_str(),textColor);
}
void hitQueue::setMessage(string mes, int xa, int ya, int hit, TTF_Font *font, SDL_Color textColor)
{
	active = true;
	x = xa;
	y = ya;
	stringstream stream;
	stream << mes << " " << hit << "!";
	message = stream.str();
	second = 0.0;
	text = TTF_RenderText_Solid(font, message.c_str(),textColor);
}
void hitQueue::move(int deltaTicks)
{
	if(second < 0.5 && active)
	{
		y -= yVel * deltaTicks / 1000.f;
		second += deltaTicks / 1000.f;
	}
	else
	{
		active = false;
		second = 0.0;
	}
}